<template>
  <div id="app">
    <router-view v-if="$route.meta.isFull"></router-view>
    <template v-else>
      <sidemenu></sidemenu>
      <page-main />
    </template>
  </div>
</template>

<script>
import sidemenu from '@/components/menu.vue';
import pageMain from '@/view/pageMain.vue';
import { mapActions } from 'vuex';
export default {
  name: 'App',
  components: {
    sidemenu,
    pageMain,
  },
  data() {
    return {
    }
  },
  mounted() {
    this.updateUserInfo().then(() => {
      this.$bus.$emit('updateMenu')
      this.updateDeviceTypes()
    // }).catch(err => {
    }).catch(() => {
      if (this.$route.path !== '/login') {
        this.$TZmessage.error('获取用户信息失败，请重新登录')
        this.$router.replace('/login')
      }
    })
  },
  methods: {
    ...mapActions('userInfo', ['updateUserInfo']),
    ...mapActions('dict', ['updateDeviceTypes']),
  }
}
</script>

<style lang="scss">
  @import './assets/sass/index.scss';
  #app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: row;
  }
  #app {
    @media print {
      height: auto;
    }
  }
</style>
